/*
 * This file is part of TradeHelper library.
 *
 * TradeHelper library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * TradeHelper library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with TradeHelper library.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.rag.assistants;

import com.alee.utils.XmlUtils;
import com.rag.core.Synonym;
import com.rag.core.SynonymData;

import java.io.File;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;

/**
 * User: mgarin Date: 13.06.12 Time: 12:55
 */

public class SynonymsGenerator
{
    private static LinkedHashMap<String, List<String>> knownSynonyms;

    public static void generateSynonyms ()
    {
        // Создаём базу синонимов
        createSynonyms ();

        // Записываем синонимы в файл
        SynonymData synonymData = new SynonymData ();
        for ( String id : knownSynonyms.keySet () )
        {
            synonymData.addSynonym ( new Synonym ( id, knownSynonyms.get ( id ) ) );
        }
        XmlUtils.toXML ( synonymData, new File ( "remote/synonyms.xml" ) );
    }

    private static void createSynonyms ()
    {
        // TODO позволять пользователю выбирать в приложении соответствия сокращений и итемов
        // TODO и добавлять собственные даже вне контекста неопознанных топиков - в просмотре итемов

        // TODO добавить возможность выявлять группы/сеты итемов (AD, Valk, Ulle, Goibne, , ...)

        // Здесь указываются специальные ИСХОДНЫЕ обозначения, привязываемые к итемам
        knownSynonyms = new LinkedHashMap<String, List<String>> ();

        // Other
        putSynonym ( "603", "Blue Box", "OBB", "ОББ" );
        putSynonym ( "616", "OCA", "ОКА", "ОСА", "Card Album", "Альбом", "Альб", "Albom", "Alb" );
        putSynonym ( "617", "Purple Box", "OPB", "ОПБ" );
        putSynonym ( "972", "Karvo", "Карво" );
        putSynonym ( "1061", "W Starsand", "W. Starsand", "Карво" );
        putSynonym ( "7037", "Coupon", "Купон", "Karen", "Карэн", "Карен" );
        putSynonym ( "7139", "FP" );
        putSynonym ( "7510", "Valh", "Valhalla" );
        putSynonym ( "12702", "Navy Box", "ONB", "ОНБ" );

        // Usable
        putSynonym ( "547", "CWP", "Слим" );
        putSynonym ( "504", "TWP", "Вайт" );
        putSynonym ( "12030", "Resentment" );

        // Cards
        putSynonym ( "4026", "F Thief Bug" );
        putSynonym ( "4031", "Peco", "Пеко", "Пека" );
        putSynonym ( "4035", "H", "Гидр" );
        putSynonym ( "4045", "Horn", "Хорн" );
        putSynonym ( "4047", "Gostring", "Ghost", "Gost", "Гоуст", "Гост", "Гоустринг",
                "Гостринг" );
        putSynonym ( "4048", "P Spore", "P. Spore" );
        putSynonym ( "4050", "M Thief Bug" );
        putSynonym ( "4053", "Витат" );
        putSynonym ( "4054", "Ангелинг" );
        putSynonym ( "4058", "Thara", "Тара" );
        putSynonym ( "4064", "Zer" );
        putSynonym ( "4101", "Sandmen", "Sendmen", "Sendman", "Сэндмен", "Сендмен", "Сэндман",
                "Сендман", "Сандмен", "Сандмэн" );
        putSynonym ( "4102", "Whisp" );
        putSynonym ( "4105", "Марк" );
        putSynonym ( "4115", "ХФ", "HF", "Хант Ф", "Hunter F", "Хантер Ф", "Hunt Fly", "Hunt. Fly",
                "H Fly", "Hunt F", "Hunt. F", "H. Fly", "Hant F", "Hant. F" );
        putSynonym ( "4117", "SW", "Sidew" );
        putSynonym ( "4120", "Скай Петит", "Sky Pet", "Петит", "Petit" );
        putSynonym ( "4128", "ГТБ", "GTB", "Golden Bug Card", "Golden Bug" );
        putSynonym ( "4129", "Bapho Jr", "Baphomet Jr" );
        putSynonym ( "4133", "Райд", "Ray", "Rayd" );
        putSynonym ( "4140", "Abys" );
        putSynonym ( "4141", "Dru", "Druid", "Друид" );
        putSynonym ( "4160", "AF", "FS", "Firelock", "Antiq", "Фаерлок", "Антик" );
        putSynonym ( "4191", "Lori Ruri", "Лоли Рури", "Лори Рури" );
        putSynonym ( "4252", "Aligator" );
        putSynonym ( "4281", "Zipper", "Зиппер", "Зипер" );
        putSynonym ( "4314", "Penom", "Pena", "Пеномен", "Пен" );
        putSynonym ( "4334", "Nox", "Нокс" );
        putSynonym ( "4337", "Porc", "Порц" );
        putSynonym ( "4349", "Errende" );
        putSynonym ( "4381", "GF", "G Ferus", "Green Feus" );
        putSynonym ( "4396", "Odium" );
        putSynonym ( "4409", "Агав" );
        putSynonym ( "4412", "Isilia", "Isil", "Исилла", "Исил" );
        putSynonym ( "4426", "Byorg", "Бьёрг" );
        putSynonym ( "4437", "Poodle", "Podle", "Пудел" );
        putSynonym ( "4450", "anshee Master" );
        putSynonym ( "4452", "Centepide Larva" );
        putSynonym ( "4453", "Hillslion" );
        putSynonym ( "4468", "Dark Pinguicila" );

        // Armor
        putSynonym ( "2111", "Sacred Mis" );
        putSynonym ( "2114", "Stone", "Stone Buck", "Stone B", "St Buck", "St. Buck", "Стоун",
                "S B", "С Б" );
        putSynonym ( "2115", "Valk Sh", "Valk. Sh", "Valk Sh", "Valkiryan Sh", "Валя Щит",
                "Valkiria Sh", "Valkyrja's Sh", "Valkyrja`s Sh", "Valkyr Sh" );
        putSynonym ( "2125", "Strong", "Стронг" );
        putSynonym ( "2128", "Sacred Mis" );
        putSynonym ( "2130", "Cross S", "Cross Sh" );
        putSynonym ( "2286", "Elven E", "E Ears", "E. Ears", "Ушки Эльфа", "Уши Эльфа",
                "Эльфийские Ушки", "Эльфийские Уши" );
        putSynonym ( "2320", "Formal", "Formal S", "F Suit", "Формал", "Формал С", "Ф Сьют" );
        putSynonym ( "2321", "Silk", "Силк" );
        putSynonym ( "2322", "Silk", "Силк" );
        putSynonym ( "2346", "Saphien" );
        putSynonym ( "2347", "Saphien" );
        putSynonym ( "2348", "Typhoon", "Тайфун" );
        putSynonym ( "2349", "Typhoon", "Тайфун" );
        putSynonym ( "2357", "Valk Arm", "Valk. Arm", "Valk Armor", "Valkiryan Arm",
                "Valkirian Arm", "Valkiria Arm", "Валя Арм", "Валя Брон" );
        putSynonym ( "2364", "Meteo Plate", "Метео Пл" );
        putSynonym ( "2365", "Gown", "Orlean", "Орлеанк" );
        putSynonym ( "2374", "Diab Rob", "Diablo Rob", "Diablus Rob", "Diab. Rob", "Di Rob",
                "Di. Rob", "D Rob", "D. Rob", "Ди Роб", "Диаб Роб" );
        putSynonym ( "2375", "Diab Arm", "Diablo Arm", "Diablus Arm", "Diab. Arm", "Di Arm",
                "Di. Arm", "D Arm", "D. Arm", "Ди Арм", "Диаб Арм" );
        putSynonym ( "2383", "Brynh", "Brunh", "Брунг", "Брунх" );
        putSynonym ( "2391", "Life Ink", "Лайф Линк", "Лайф Инк" );
        putSynonym ( "2403", "Sho", "Шуз" );
        putSynonym ( "2404", "Sho", "Шуз" );
        putSynonym ( "2421", "Valk Sho", "Valk. Sho", "Валя Шуз", "Валя Бут" );
        putSynonym ( "2423 ", "Variant", "Варики", "Варианты" );
        putSynonym ( "2424", "Tidal", "Тидал" );
        putSynonym ( "2425", "BlB", "БлБ" );
        putSynonym ( "2433", "Diab Boots", "Diablo Boots", "Diablus Boots", "Diab. Boots",
                "Di Boots", "Di. Boots", "D Boots", "D. Boots", "Ди Бут", "Диаб Бут", "Ди Бот",
                "Диаб Бот", "Diab. B", "Diab B" );
        putSynonym ( "2434", "BlB", "БлБ" );
        putSynonym ( "2503", "Muf", "Maff", "Мафлер", "Муф" );
        putSynonym ( "2504", "Muf", "Maff", "Мафлер", "Муф" );
        putSynonym ( "2514", "Paudron" );
        putSynonym ( "2519", "Morrig M", "Morrig M", "Morrigan M", "Morrigane M" );
        putSynonym ( "2524", "Valk Mant", "Valk. Mant", "Valk Manteau", "Valkiryan Mant",
                "Valkyr Mant", "Valkirian Mant", "Valkiria Mant", "Валя Мант" );
        putSynonym ( "2528", "Wool", "Вулка" );
        putSynonym ( "2537", "Diab Mant", "Diablo Mant", "Diab. Mant", "Di Mant", "Di. Mant",
                "D Mant", "D. Mant", "Ди Мант", "Диаб Мант" );
        putSynonym ( "2542", "Flame Mant" );
        putSynonym ( "2554", "Nydh", "Shadow Garb", "Nyd Shad", "NSG", "N S Garb", "Нидхог",
                "Гарб" );
        putSynonym ( "2620", "Rogue" );
        putSynonym ( "2629", "Mejingjard", "Мега", "Мегу" );
        putSynonym ( "2655", "Bloodied Shackle", "Шарики", "Blood Shack", "Bl Sh B", "BSB",
                "Shack Ball", "Shackle Ball" );
        putSynonym ( "2659", "Core 01", "Core 1" );
        putSynonym ( "2660", "Core 02", "Core 2" );
        putSynonym ( "2661", "Core 03", "Core 3" );
        putSynonym ( "2662", "Core 04", "Core 4" );
        putSynonym ( "2678", "Flame Lord", "Ring of F L" );
        putSynonym ( "2679", "Resonan", "Rezonan", "Резонан" );
        putSynonym ( "2701", "Orl Glove", "Orlean Glove" );
        putSynonym ( "2729", "D Ring", "Di Ring", "Diab Ring", "D. Ring", "Di. Ring" );
        putSynonym ( "2843", "GB", "BG", "Bells", "Golden B", "Golden Bell" );
        putSynonym ( "2853", "Telec", "Telek" );
        putSynonym ( "5123", "Ulle", "Ульк" );
        putSynonym ( "5135", "Cyclop", "Ciclop", "Циклоп", "Цыклоп" );
        putSynonym ( "5171", "Valk Helm", "Valk. Helm", "Valkiryan Helm", "Valkirian Helm",
                "Valkiria Helm", "Валя Шлем", "Валя Шапк" );
        putSynonym ( "5292", "Dragon Skul", "Drag Skul" );
        putSynonym ( "5361", "Gagnster Scarf" );
        putSynonym ( "5374", "Gigant Maj", "Gigantic Maj", "Gigantic M", "Bapho Horns", "Рога",
                "Giant Maj", "Giant Mag", "Gig Maj", "GMG" );
        putSynonym ( "13412", "Twin Edge", "Edge of N", "Twin Edge of Naght",
                "Edge of Naght Sieger", "Edge Naght Sieger" );
        putSynonym ( "13413", "Twin Edge", "Edge of N", "Twin Edge of Naght",
                "Edge of Naght Sieger", "Edge Naght Sieger" );
        putSynonym ( "13414", "Elemental Swd" );
        putSynonym ( "15032", "Tidun", "Тидун" );
        putSynonym ( "19990", "MOTR Rose", "Роза", "R Rose", "R. Rose" );
        putSynonym ( "19988", "MOTR Mask", "МОТР Маск", "Феникс Маск", "Phoenix", "Феникс" );
        putSynonym ( "19989", "MOTR Wing", "МОТР Винг", "МОТР Крыл", "Крыл", "Винг", "Wings" );
        putSynonym ( "19998", "MOTR Hat", "МОТР Шапк", "МОТР Шляп" );

        // Weapon
        putSynonym ( "1191", "Arc Bringer", "Арк Брингер", "Алка Брингер" );
        putSynonym ( "1231", "Bazer", "Базер" );
        putSynonym ( "1421", "Hook", "B Hook", "Батл Хук", "Хук", "Б Хук" );
        putSynonym ( "1549", "Pile", "Пайл" );
        putSynonym ( "1624", "Lich Bone", "Lich's Bone", "Lich`s Bone", "Lich", "Lich B. W." );
        putSynonym ( "1626", "Pierc", "Pierc. Staff" );
        putSynonym ( "1636", "Thorn S", "Thorn St", "Thorn Staff", "Staff Of Dark" );
        putSynonym ( "1646", "La'crima", "La`crima", "Lacrima" );
        putSynonym ( "1704", "Composite", "Композит" );
        putSynonym ( "1705", "Composite", "Композит" );
        putSynonym ( "1706", "Composite", "Композит" );
        putSynonym ( "1734", "OAB", "ОАБ" );
        putSynonym ( "1746", "Elv", "Elv Bow", "Elven", "Элвен", "Элвен Лук" );
        putSynonym ( "2000", "Destruction", "Staff of Destr", "Staf of Dest", "SOD", "Дестракшн" );
        putSynonym ( "13107", "Wasteland" );
        putSynonym ( "16003", "Kalga", "Carga", "Calga", "Калг" );
    }

    private static void putSynonym ( String id, String... synonyms )
    {
        knownSynonyms.put ( id, Arrays.asList ( synonyms ) );
    }
}